package com.bea.ftd.common.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

import com.bea.ftd.common.enums.DateFormatEnum;
import com.bea.ftd.common.intf.IGatewayEntity;
import com.bea.ftd.common.utils.DateUtil;

import lombok.Data;

@Data
@Entity
@Table(name = "secret_info")
public class SecretInfo  implements IGatewayEntity {

	private static final long serialVersionUID = 1515298736993286261L;

	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private Long id;

	@Column(name = "partner_code")
	private String partnerCode;

	@Column(name = "encrypt_type")
	private String encryptType;

	@Column(name = "sign_type")
	private String signType;

	@Column(name = "is_encrypt_hardware")
	private Long isEncryptHardware;

	@Column(name = "encrypt_hardware_ip")
	private String encryptHardwareIp;

	@Column(name = "private_key_path")
	private String privateKeyPath;

	@Column(name = "public_key_path")
	private String publicKeyPath;

	@Column(name = "is_activated")
	private Long isActivated;

	@Column(name = "create_time")
	private java.util.Date createTime;

	@Column(name = "update_time")
	private java.util.Date updateTime;

	@Column(name = "encrypt_hardware_port")
	private Integer encryptHardwarePort;
	
	public String getFormatCreateTime() {
		if (null == createTime) {
			return "";
		}
		return DateUtil.formatDate(createTime, DateFormatEnum.YEAR_MONTH_DAY_HOUR_MINUTE_SECOND);
	}

	public String getFormatUpdateTime() {
		if (null == updateTime) {
			return "";
		}
		return DateUtil.formatDate(updateTime, DateFormatEnum.YEAR_MONTH_DAY_HOUR_MINUTE_SECOND);
	}

}
